# coding:utf-8
import time
import mock.views as mviews


# Create your views here.

def defaultResponse(request, api=None, router=None):
    """
    对数据不进行处理直接返回模板数据
    :param request:
    :param api:
    :param router:
    :return:
    """
    mviews.checkUrl(request, api, router)
    # print("default:" + str(api) + "  " + str(router))
    responseModel = mviews.getResponseData(api, router)  # 从数据库获取返回值模板
    delay = responseModel.delay
    modelJson = responseModel.json
    if delay>0:
        print('\nSleep:' + str(delay) + ' ms')
        time.sleep(delay)
    return mviews.createJSONResponse(modelJson)
